package com.cabinet.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cabinet.service.IUserOrderService;
import com.cabinet.service.dao.OrderDao;
import com.cabinet.service.dto.MyOrderDto;
import com.cabinet.service.mybatis.IctOrderMapper;
import com.cabinet.web.entity.Order;
@Service
public class UserOrderService implements IUserOrderService{

	@Autowired
	private OrderDao orderDao;
	@Autowired
	private IctOrderMapper ictOrderMapper;
	
	@Override
	public Order createOrder(Order o) {
		// TODO Auto-generated method stub
		return orderDao.save(o);
	}

	@Override
	public Order getOrderById(Long id) {
		// TODO Auto-generated method stub
		return orderDao.findOne(id);
	}

	@Override
	public Order updateOrder(Order o) {
		// TODO Auto-generated method stub
		return orderDao.save(o);
	}

	@Override
	public List<MyOrderDto> getOrderByUserId(Long userId) {
		// TODO Auto-generated method stub
		return ictOrderMapper.selectUserOrderByUserId(userId);
	}







}
